#include <iostream>
#include <vector>

using namespace std;

int LIS(vector<int>& arr) 
{
    int n = arr.size();
    vector<int> dp(n + 1, 1);
    int ans = 0;
    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j < i; j++)
        {
            if (arr[i] >= arr[j])
            {
                dp[i] = max(dp[i], dp[j] + 1);
                ans = max(ans, dp[i]);
            }
        }
    }

    return ans;
}

int main()
{
    vector<int> v = { 6,3,1,5,2,3,7 };
    cout << LIS(v) << endl;
    return 0;
}